It is often useful to profile a program to collect information about code execution within the program. For instance, it may be desirable to collect information about what portions of code are executed most frequently. With such information, the program developer can focus his or her optimization efforts on the code “hot spots” with the goal of increasing program performance. Such optimization may include, for example, creation of more efficient function calls or, in certain situations, elimination of function calls in favor of inline code.
Currently, profiler utilities are used to provide information about code usage. Such profiler utilities typically monitor execution of a program under evaluation to identify the number of times each program function is called during that execution. For example, a profiler utility may periodically sample the stack trace to identify what function calls are being made at each periodic instance. From this sampling, the profiler utility can obtain an indication as to what functions are called most frequently.
Although profiler utilities provide some indication as to code usage, this solution typically requires recompiling of the code and insertion of tracking instructions (i.e., instrumentation of the code). Such instrumentation requires additional work from the program developer and adds overhead to the code. In addition, although profiler utilities detect when a given function is called, they typically cannot determine which particular instructions of the function are actually executed. Therefore, a situation can arise in which, although only a few lines of code of a given function are frequently executed, the profiler utility cannot specifically identify those lines. Further, because such profiler utilities only periodically sample the stack trace, they do not provide an exact indication as to what code portions are being executed with the highest frequency. Moreover, profiler utilities normally cannot be used until the underlying code system is completed and running.